package cn.gson.crmdemo.common;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.core.convert.converter.Converter;

public class DateConverter implements Converter<String,Date> {

	private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    @Override
    public Date convert(String s) {
       if ("".equals(s) || s == null) {
           return null;
       }
       try {
           return simpleDateFormat.parse(s);
        } catch (ParseException e) {
           e.printStackTrace();
        }
       return null;
    }
}
